package cruciverba.model;

import java.util.StringTokenizer;


public class ElencaIntersezioniStringhe implements IVerifica {

	@Override
	public int verify(String string) throws Exception {
				
		string = string.toLowerCase();
		StringTokenizer strtok = new StringTokenizer(string, ",");

		if(strtok.countTokens() != 2) {
			throw new Exception("Separate the words with a comma");
		}
		
		String string1 = strtok.nextToken();
		String string2 = strtok.nextToken();
		
		string1 = string1.trim();
		string2 = string2.trim();
		

		CruciverbaUtils.isWord(string1);
		CruciverbaUtils.isWord(string2);
		
		for (int i = 0; i < string1.length(); i++) {
			if(string2.contains(String.valueOf(string1.charAt(i)))){
		//		commonChar++;
			}
		}
		
		return 0;
	}


	@Override
	public String modellaVerify(String string) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

}
